#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QFileDialog>
#include "item.h"
#include "line.h"

class Line;
class Item;
class QGraphicsItem;
class QGraphicsScene;
class QGraphicsView;

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    typedef QPair<Item *, Item *> ItemPair;
    Ui::MainWindow *ui;
    QGraphicsScene * Scene;
    QGraphicsView * View;
    int iElementsCount;
    Item * SelectedItem() const;
    ItemPair SelectedItemPair() const;
    QString sFilename;
    Item * GetItemById(QList<Item *> lst, int id);
    void ClearAll();
	qreal x,y;

private slots:
    void New();
    void Save();
    void SaveAs();
    void OpenProperties();
    void Open();
    void Exit();
    void SaveJpeg();
    void AddNode();
    void AddLine();
    void AddDevice();
    void AddStream();
    void AddComment();
    void Delete();
    void SelectionChanged();
    void SceneChanged(QList<QRectF>);
};

#endif // MAINWINDOW_H
